var router = require('koa-router')();
var models = require('./../models');


router.get('/home', function* (next) {
    var projects = yield models.Project.findAll();
    this.render('home.jade', {
        projects: projects
    });
});

router.post('/refreshDatabase', function* (next) {
    console.log('重置数据库');
    yield models.sequelize.sync({ force: true });
    this.redirect('/home');
});

module.exports = router.routes();
